﻿using Red.Controls.Notification;
using Red.Controls.ViewModels;
using Red.Core;

namespace Red.Controls.Shell
{
    public enum EditorKind
    {
        EngineResource,
        StandaloneResource,
        Custom
    }

    /// <summary>
    ///     Data specific to particular editor instance.
    /// </summary>
    public class EditorInstanceData
    {
        #region Properties

        /// <summary>
        ///     The string identifying the single editor instance. The framework ensures that there is always only one 
        ///     instance of specific editor type with a given IntanceContext. Usually it's an id based on the resource being edited.
        /// </summary>
        public string InstanceContext { get; private set; }

        /// <summary>
        ///     Additional params passed to the editor via command-line.
        /// </summary>
        public CommandLineDictionary AdditionalParams { get; private set; }

        /// <summary>
        ///     For editors using the Interop, here is an engine root object.
        /// </summary>
        public InteropDataItem RootEditorItem { get; set; }

        /// <summary>
        ///     What kind of editor it is
        /// </summary>
        public EditorKind EditorKind { get; private set; }

        /// <summary>
        ///     Editor name is used to construct title bar text.
        /// </summary>
        public string EditorName { get; set; }

        /// <summary>
        /// Popup notification dispatcher.
        /// </summary>
        public NotificationDispatcher NotifyDispatcher { get; private set; }

        #endregion Properties

        #region C-tor

        public EditorInstanceData( string instanceContext, CommandLineDictionary additionalParams, EditorKind kind )
        {
            InstanceContext = instanceContext;
            AdditionalParams = additionalParams;
            EditorKind = kind;
            NotifyDispatcher = null;
        }

        #endregion C-tor

        #region Methods
        
        /// <summary>
        /// Initializes notification dispatcher.
        /// </summary>
        public void InitializeNotificationDispatcher( NotificationDispatcher dispatcher )
        {
            NotifyDispatcher = dispatcher;
        }

        #endregion Methods

    }
}
